
#include "stdafx.h"
#include "TankFactory.h"
#include <string>

_Tank TankFactory::BuildTank(std::string body, std::string chasis)
{
  // Bouml preserved body begin 0001F97B

	_TankBody tankBody(new TankBody( body ));
	tankBody->Assemble();
	_TankChasis tankChasis(new TankChasis( chasis ));
	tankChasis->Assemble();
	tankBody->AttachChasis( tankChasis );

	_Tank tank( new Tank( tankBody ) );

	return tank;
  // Bouml preserved body end 0001F97B
}

_Tank TankFactory::BuildBase1Tank()
{
  // Bouml preserved body begin 0001F422
    static const char * partName = "base1";
    
    _Tank tank;
	tank = BuildTank( partName, partName );
    _TankBody tankBody( tank->GetBody() );
    
    _TankTurret tankTurret( MountTurret( tankBody, 0, partName ) );

	MountGun( tankTurret, 0, partName );
    
    return tank;
  // Bouml preserved body end 0001F422
}

_TankTurret TankFactory::MountTurret(const _TankBody & tankBody, char slot, std::string name)
{
  // Bouml preserved body begin 0001F5A2
    _TankTurret tankTuret( new TankTurret(name) );
    tankTuret->Assemble();
    tankBody->AttachTurret( tankTuret, slot );
    
    return tankTuret;
  // Bouml preserved body end 0001F5A2
}

_TankGun TankFactory::MountGun(const _TankTurret & tankTurret, char slot, std::string name)
{
  // Bouml preserved body begin 000233FB
	_TankGun tankGun( new TankGun(name) );
	tankGun->Assemble();
	tankTurret->AttachGun( tankGun, slot );

	return tankGun;
  // Bouml preserved body end 000233FB
}

